package cn.fj.hrm.document;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;


@Data
@Document(indexName = "hrm", type = "course")
public class CourseDoc {
    @Id
    private Long id;

    //课程名称
    @Field(type = FieldType.Text,store = true,analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    private String name;

    //适用人群
    @Field(type = FieldType.Keyword,store = true)
    private String forUser;

    //课程类别id
    @Field(type = FieldType.Long,store = true)
    private Long courseTypeId;
    //课程类别名称
    @Field(type = FieldType.Keyword,store = true,fielddata = true)
    private String courseTypeName;

    //课程等级id
    @Field(type = FieldType.Long,store = true)
    private Long gradeId;
    //等级名称
    @Field(type = FieldType.Keyword,store = true,fielddata = true)
    private String gradeName;

    //所属机构id
    @Field(type = FieldType.Long,store = true)
    private Long tenantId;
    @Field(type = FieldType.Keyword,store = true,fielddata = true)
    private String tenantName;

    //开始时间
    @Field(type = FieldType.Long,store = true)
    private Long startTime;
    //结束时间
    @Field(type = FieldType.Long,store = true)
    private Long endTime;

    //课程的封面图片
    @Field(type = FieldType.Keyword, index = false, store = true)
    private String pic;

    /**
     * 收费规则，对应数据字典,免费，收费
     */
    @Field(type = FieldType.Integer,store = true)
    private Integer charge;
    /**
     * 原价
     */
    @Field(type = FieldType.Float,store = true)
    private Float priceOld;
    /**
     * 价格
     */
    @Field(type = FieldType.Float,store = true)
    private Float price;
    /**
     * 简介
     */
    @Field(type = FieldType.Keyword, index = false, store = true)
    private String description;

    @Field(type = FieldType.Keyword, index = false, store = true)
    private String intro;

    //排序条件
    //上线时间
    @Field(type = FieldType.Long, store = true)
    private Long onlineTime;
    //销量
    @Field(type = FieldType.Integer, store = true)
    private Integer saleCount;
    //浏览量
    @Field(type = FieldType.Integer, store = true)
    private Integer viewCount;
    //评论数
    @Field(type = FieldType.Integer, store = true)
    private Integer commentCount;

    //课程的多张图片，以逗号隔开
    @Field(type = FieldType.Keyword,index = false,store = true)
    private String resources;

}
